package com.itheima.utils;

import com.qiniu.common.QiniuException;
import org.junit.Test;

/**
 * @author 吴
 * @version V1.0
 * @Description  测试七牛云提供的SDK实现将本地图片上传七牛云服务上
 * @Package com.itheima.utils
 * @date 2021/11/23 18:28
 */
public class UploadFile {
    // 上传
    @Test
    public void uploadTest(){
        String filePath = "C:\\Users\\86159\\Desktop\\img\\OIP-C1.jpg";
        String fileName = "OIP-C1.jpg";
        try {
            QiniuUtils.upload2Qiniu(filePath,fileName);
        } catch (QiniuException e) {
            e.printStackTrace();
        }
    }

    // 删除
    @Test
    public void  deleteFileTest(){
        String fileName = "OIP-C1.jpg";
        try {
            QiniuUtils.deleteFileFromQiniu(fileName);
        } catch (QiniuException e) {
            e.printStackTrace();
        }
    }
}
